<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>个人中心</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .profile-container { max-width: 500px; margin: 40px auto; }
    </style>
</head>
<body>
    <div class="container profile-container">
        <h2 class="mb-4">个人中心</h2>
        <form action="profile" method="post">
            <div class="mb-3">
                <label class="form-label">用户名</label>
                <input type="text" class="form-control" name="username" value="${user.username}" readonly>
            </div>
            <div class="mb-3">
                <label class="form-label">姓名</label>
                <input type="text" class="form-control" name="name" value="${user.name}" required>
            </div>
            <div class="mb-3">
                <label class="form-label">邮箱</label>
                <input type="email" class="form-control" name="email" value="${user.email}" required>
            </div>
            <div class="mb-3">
                <label class="form-label">新密码（如需修改）</label>
                <input type="password" class="form-control" name="password" placeholder="不修改请留空">
            </div>
            <div class="mb-3">
                <label class="form-label">角色</label>
                <input type="text" class="form-control" value="${user.role}" readonly>
            </div>
            <div class="mb-3">
                <label class="form-label">注册时间</label>
                <input type="text" class="form-control" value="${user.createdAtStr}" readonly>
            </div>
            <button type="submit" class="btn btn-primary w-100">保存修改</button>
        </form>
        <a href="dashboard" class="btn btn-outline-secondary w-100 mt-2">返回</a>
        <c:if test="${not empty error}">
            <div class="alert alert-danger mt-3">${error}</div>
        </c:if>
        <c:if test="${not empty success}">
            <div class="alert alert-success mt-3">${success}</div>
        </c:if>
    </div>
</body>
</html> 